<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>鼠标跟随</title>
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}
			
			.fllower {
				width: 40px;
				height: 40px;
				position: fixed;
				background: skyblue;
				top: 0;
				left: 0;
				border-radius: 50%;
			}
		</style>
	</head>
	<body>
		
		<div class="fllower">
			
		</div>
		<a href="http://baidu.com"></a>
		<script type="text/javascript">
//		console.log(window.screen.width);  屏幕宽度
//		console.log(window.screen.height);   屏幕高度  

//		console.log(window.screen.availHeight);  
//		console.log(window.screen.availWidth);
//		
//		console.log(window.screen.innerHeight);
		
		
		
			var fllower = document.querySelector(".fllower"),x,y,
			body_height = window.screen.availHeight,
			window_height = window.outerHeight,
			diffent = body_height-window_height;
				window.addEventListener("mousemove",function(e){
					 	x = e.screenX-20;
					  	y = e.screenY-diffent-70;
					  	fllower.style.top = y+"px";
					  	fllower.style.left = x+"px";
					  	
				})
		</script>
	</body>
</html>
